﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Xml.Linq;
using Nova_DAL;
using System.Data.Common;
using Nova_Common;

using System.Data;

public partial class Views_MetarPOP : System.Web.UI.Page
{
    string strSQL = "";
    DbHelper access = new DbHelper();
    DbCommand cmd = null;
    DataSet ds = null;
    string strPOS_ID = "";

    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            strPOS_ID = Request["PosID"].ToString();
        }
        catch
        {
            Response.Write("请关闭窗口，重新选择货位。");
            return;
        }
        if (!IsPostBack)
        {
            bind();
        }
    }

    protected void bind()
    {
        try
        {
            strSQL = @"SELECT TBM.Mat_Code,TBM.Mat_Name,TBP.Pos_ID,TBM.Unit_Base,TBM.S05,TBM.S01,TBM.TM01,TBM.TM03,TBM.S02,TBS.Mat_Num,TRP.Tray_ID,TBI.TS01 FROM TBase_Position TBP 
                    LEFT JOIN TRelations TRP ON TBP.Pos_ID = TRP.Pos_ID
                    LEFT JOIN TBase_TrayPos TBT ON TBT.Tray_ID = TRP.Tray_ID
                    LEFT JOIN TRel_TrayPosContainer TRT ON TRT.Relations_ID = TBT.Relations_ID
                    LEFT JOIN TBase_Storage TBS ON TBS.ContainerID = TRT.ContainerID
                    LEFT JOIN TBase_Interface TBI ON TBI.Sec_Mat_ID = TBS.Sec_Mat_ID
                    LEFT JOIN TBase_Material TBM ON TBM.Mat_Code = TBI.Mat_Code WHERE 1=1 ";
            strSQL += " and TBP.Pos_ID = '" + strPOS_ID.ToString() + "'";
            strSQL += " ORDER BY TBS.CDT DESC";
            cmd = access.GetSqlStringCommond(strSQL);
            ds = access.ExecuteDataSet(cmd);
            gv.DataSource = ds;
            gv.DataBind();
        }
        catch (Exception ex)
        {

        }
    }
}
